package com.view.text;

import javax.swing.*;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.io.IOException;
import java.net.URI;

public class TextMain {
    private JFrame jf=new JFrame("关于");
    private JLabel jl=new JLabel();
    private JButton jb=new JButton("码云仓库");
    public TextMain(){
        jf.setSize(300,200);
        jf.setLocation(300,300);
        jf.setLayout(null);
        jl.setSize(300,70);
        jl.setLocation(0,0);
        jl.setText("         本次实验作业由\n李伟国、沈康飞\n共同制作");
        jb.setSize(100,30);
        jb.setLocation(100,70);
        java.awt.Desktop dp = java.awt.Desktop.getDesktop();
        jb.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if(e.getSource().equals(jb)){
                    try {
                        dp.browse(URI.create("https://gitee.com/Cirmasters/football_contest/"));// 获取系统默认浏览器打开链接
                    } catch (IOException ex) {
                        ex.printStackTrace();
                    }
                }
            }
        });
        jf.add(jb);
        jf.add(jl);
        jf.setVisible(true);
    }
}
